<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery1.9/jquery-1.9.0.js"></script>
    <script>
        $(function(){
            $("input:eq(0)").click(function(){
               $("div[class]").css("background","red");
            });
            $("input:eq(1)").click(function(){
                $("div[id='heihei']").css("background","blue");
            });
            $("input:eq(2)").click(function(){
                $("p[id!='xixi']").css("background","pink");
            });
            $("input:eq(3)").click(function(){
                $("p[id^='ba']").css("background","hotpink");
            });
            $("input:eq(4)").click(function(){
                $("li[hello$=ld]").css("background","cyan");
            });
            $("input:eq(5)").click(function(){
                $("li[id*=eh]").css("background","cyan");
            });
            $("input:eq(6)").click(function(){
                $("p[class][name^=ha][id$=xi]").css("background","cyan");
            });
        });
    </script>
</head>
<body>
    <input type="button" value="选择包含class属性的div元素">
    <input type="button" value="选择包含id属性值等于heihei的div元素">
    <input type="button" value="选择包含id属性值不等于xixi的p元素">
    <input type="button" value="选择包含id属性值以ba开头的p元素">
    <input type="button" value="选择包含hello属性值以ld结尾的li元素">
    <input type="button" value="选择包含id属性值包含eh的li元素">
    <input type="button" value="选择包含class属性，并且name属性以ha开头，并且id属性以xi结尾的p元素">
    <p>welcome to nanjing</p>
    <div>我是div
        <p class="hello">hello itany</p>
    </div>
    <div id="mydiv">
        我是div
        <span id="hello">hello</span>
        <p>welcome to wbs20101</p>
    </div>
    <p id="babc">welcome to wbs20101</p>
    <p id="baby">p</p>
    <div id="heihei">mydiv</div>
    <div class="hehe">div</div>
    <p id="xixi">welcome to wbs20101</p>
    <div>happy wbs20101</div>
    <p>
        我是p
        <span>span</span>
    </p>
    <p hello="haha" name="haha" id="xixi" class="bb">welcome</p>
    <li id="aehaa">li01</li>
    <li hello="world">li02</li>
    <li id="world">li03</li>
    <li hello="hi">li04</li>
    <li id="hehe">li05</li>
</body>
</html>